<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%
	String category=(String)request.getAttribute("cat");
	String title=null;
	if(category.equalsIgnoreCase("1")){
		title="權重300";
	}else if(category.equalsIgnoreCase("2")){
		title="台灣50成份股";
	}else if(category.equalsIgnoreCase("3")){
		title="台灣50 VS FITX";
	}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=BIG5">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> 
<META HTTP-EQUIV="Expires" CONTENT="0"> 
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/jquery.blockUI.js"></script>
<title><%=title %></title>
<style type="text/css">
#main{
	margin: auto;
	width: 500px;
	padding-top:3em;
}
#main table{
	width: 99%;
}

#main td ,#main th{
	border: 2px solid #98bf21;
}

.tr_in{
	background-color: #FFFFCC;
    color: blue;
    FONT-SIZE: 1.2em;
    CURSOR: pointer;
}
</style>
<script>
	$(document).ready(function(){
		$(".tQty").each(function(index){
			var tot=parseInt($(this).siblings(".tot").text());
			var bsum=parseInt($(this).siblings(".bsum").text());
			var ssum=parseInt($(this).siblings(".ssum").text());
			if(<%=category %>==1)
				var sum=270*300;
			else
				var sum=270*50;
			sum=sum-(tot+bsum+ssum);
			$(this).text(sum);
		});
		$('.data').hover(function(){
         		$(this).addClass('tr_in');
			},function(){
		    	$(this).removeClass('tr_in');
		});
	});
	function change(){
		var fun=$("#fun").val();
		if(fun!=''){
			goTo('stockDayDis?category='+fun);
		}
	}
	
	function goTo(url){
		$.blockUI({message: '<img src="../images/loader2.gif" />'});
		window.location=url;
	}	
	
</script>
</head>
<body >
<div id="main">
<table>
	<tr>
		<td colspan="5" align="left">
			前往其他功能 :
			<select id="fun" onchange="change();">
				<option selected="selected" value="">--請選擇--</option>
				<option value="1">權重300</option>
				<option value="2">台灣50成份股</option>
				<option value="3">台灣50 VS FITX</option>
			</select>
		</td>
	</tr>
	<tr>
		<td colspan="5" align="center" style="font-size: 2.3em;">
			<%=title %>
		</td>
	</tr>
	<tr>
		<th>日期</th>
		<th>平手</th>
		<th>命中</th>
		<th>失敗</th>
		<th>不成立</th>
	</tr>
   <c:forEach items="${list}" var="sb"> 
       <tr onclick="goTo('stockDayData?date=${sb.date}&a1=${sb.tot}&a2=${sb.bsum}&a3=${sb.ssum}&category=${cat}')" class="data"> 
           <td align="center">${sb.date}</td> 
           <td align="center" class="tot">${sb.tot}</td>
           <td align="center" class="bsum">${sb.bsum}</td>
           <td align="center" class="ssum">${sb.ssum}</td>
           <td align="center" class="tQty"></td>
       </tr> 
   </c:forEach> 
</table>
</div>
</body>